//------------------------------------------------------------------------------
// <pcdd-entitiy>
//     系统管理业务类库
//     管理员业务对象
// </pcdd-entitiy>
//------------------------------------------------------------------------------

using CL.Enum.Common;
using CL.SystemInfo.DAL;
using CL.SystemInfo.Entity;
using CL.Tools.Common;
using CL.View.Entity.SystemInfo;
using System.Collections.Generic;

namespace CL.SystemInfo.BLL
{

    /// <summary>
    /// ManagerBLL 业务
    /// </summary>
    public class ManagerBLL
    {
        ManagerDAL dal = new ManagerDAL(DbConnectionEnum.CaileSystem);

        /// <summary>
        /// 插入对象
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public int InsertEntity(ManagerEntity entity)
        {
            return dal.InsertEntity(entity);
        }
        /// <summary>
        /// 修改对象
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public int ModifyEntity(ManagerEntity entity)
        {
            return dal.ModifyEntity(entity);
        }
        /// <summary>
        /// 查询对象
        /// </summary>
        /// <param name="UserName"></param>
        /// <param name="PassWord"></param>
        /// <returns></returns>
        public ManagerEntity QueryEntity(string UserName, string PassWord, bool IsEncrypt)
        {
            if (IsEncrypt)
            {
                PassWord = Utils.MD5(PassWord);
            }
            return dal.GetModel(UserName, PassWord);
        }
        /// <summary>
        /// 查询对象
        /// </summary>
        /// <param name="UserName"></param>
        /// <param name="PassWord"></param>
        /// <returns></returns>
        public ManagerEntity GetModel(int id)
        {
            return dal.GetModel(id);
        }
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(string UserName)
        {
            return dal.Exists(UserName);
        }
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(int id)
        {
            return dal.Exists(id);
        }
        /// <summary>
        /// 删除对象
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public bool DelEntity(int id)
        {
            return dal.DelEntity(id);
        }
        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        public List<udv_Manager> QueryListByPage(int RoleType, string strName, string orderby, int pageSize, int pageIndex, ref int recordCount)
        {
            return dal.QueryListByPage(RoleType, strName, orderby, pageSize, pageIndex, ref recordCount);
        }
    }
}
